﻿using System;
using System.Collections.Generic;
using System.Text;

namespace BaseSimpleAPI
{
    public class ErrorResult : IActionResult
    {
        private string Str = null;
        private Dictionary<string, string> Header = null;

        public ErrorResult(string str, Dictionary<string, string> header)
        {
            Str = str;
        }

        public byte[] GetRespondData()
        {
            ResponseHeaderHelper.GetInstance().TrimResponseHeader(new List<string>(Header?.Keys).ToArray());
            
            ResponseHeaderHelper.GetInstance().CompletionResponseHeader(Header ?? new Dictionary<string, string>());

            return ActionResultHelper.GetResponseData(Str);
        }
    }
}
